<?php

/**
 * This file is part of project alg-performance.
 *
 * Author: Jake
 * Create: 2019-04-26 16:08:48
 */

namespace App\Services;

use Illuminate\Http\Request;

/**
 * Trait CrudActions
 * @package App\Services
 *
$
 */
trait CrudActions
{
    public function query(Request $request)
    {
        $result = $this->callModelService('query', $request->all());

        return success($result);
    }

    public function create(Request $request)
    {
        $result = $this->callModelService('create', $request->all());

        return rpc_response($result);
    }

    public function edit($id, Request $request)
    {
        $result = $this->callModelService('edit', $id, $request->all());

        return rpc_response($result);
    }

    public function get($id, Request $request)
    {
        $result = $this->callModelService('get', $id, $request->all());

        return rpc_response($result);
    }

    public function delete($id, Request $request)
    {
        $result = $this->callModelService('delete', $id, $request->all());

        return rpc_response($result);
    }
}
